@extends('front.common.header')

@section('title',$result->title.' - 就业指南')

@section('head')
@parent
@stop

@section('content')
<link href="{{ asset('/css/employ/list.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('/css/employ/moban.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('/css/company/jobs.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('/css/company/comdetails.css') }}" rel="stylesheet" type="text/css">
<div class="main">
    <div class="content">
        <div class='top-nav'>
    		<ul>
    			{!! $mianbaoxie !!}
    		</ul>
    	</div>
    </div>
    <div class="employ-list"   style="position: relative;">
        <div class="employ-list-left fl">
            <div class="employ-search mb20">
                <div class="employ-info employ-tags">
                    @if(!empty($employTags))
                    @foreach($employTags as $etags)
                     <span class="tags">{{ $etags }}</span>
                    @endforeach
                    @endif
                </div>
                <div class="employ-info employ-title">
                    {{$result->title}}
                </div>
                <div class="employ-info">
                    <div class="employ-info-ext fl">
                        <div class="user-info-avatar fl cp" @if(empty($authuser)) onclick="loginTips()"@else onclick="message('/message?ruid={{$result->user->id}}','{{ csrf_token() }}')" @endif>
                            <img src="{{ userlogo($result->user->id,'small') }}" >
                        </div>
                        <div class="user-info-uname ml-20 fl cp" @if(empty($authuser)) onclick="loginTips()"@else onclick="message('/message?ruid={{$result->user->id}}','{{ csrf_token() }}')" @endif>{{$result->user->name}}</div>
                        <div class="user-info-createtime ml-20 fl">发表于{{$result->created_at}}</div>
                        <div class="user-info-createtime ml-10 fl">|</div>
                        <div class="dropdown user-info-createtime ml-10 fl">
                            <form action="{{url('/reports')}}" method="POST" onsubmit="return checkParam('{{empty($authuser)?0:1}}',this)">
                                {{csrf_field()}}
                               <input type="hidden" name="app" value="employ">
                               <input type="hidden" name="app_id" value="{{$result->id}}">
                               <input type="hidden" name="app_url" value="{{Request::getRequestUri()}}"> 
                               <input type="hidden" name="report_type" value="1">
                               <a href="javascript:void(0)" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 举报<span class="caret"></span></a>
                               <ul class="dropdown-menu" aria-labelledby="dLabel">
                                    <li><button type="submit">个人信息举报</button></li>
                                    <li><button type="submit" onclick="$('input[name=report_type]').val(2);">垃圾信息举报</button></li>
                               </ul>
                            </form>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="employ-info-ext fl">
                        <ul>
                            <li class="color-orange">
                                <img src="{{ asset('/images/front/jiuyezhinan/view.png') }}" title="浏览">
    							{{ count($result->exts)>0 ?$result->exts->reading_num+1 : 0}}
    						</li>
                            <li class="color-orange">
                                <img src="{{ asset('/images/front/jiuyezhinan/pl.png') }}" title="评论">
    							{{ count($result->exts)>0?$result->exts->comment_num:0}}
    						</li>
    						@if(empty($result->is_collect) || $result->is_collect == 0)
                            <li class="color-gray" id="collect_num">
                                <a href="javascript:void(0);" onclick="toCollect('/member/collect','employ','{{$result->id}}','{{ csrf_token()}}','{{empty($authuser)?0:$authuser->id}}')">
                                    <img src="{{ asset('/images/front/heart-no.png') }}" title="收藏" >&nbsp;&nbsp;
                                </a>
                                    <span class="color-gray">{{ count($result->exts)>0?$result->exts->recommond_num:0}}</span>
                                
                            </li>
                            @else
                            <li class="color-gray" id="collect_num">
                                <img src="{{ asset('/images/front/jiuyezhinan/red-heart.png') }}" title="收藏">&nbsp;&nbsp;
                                <span>{{ count($result->exts)>0?$result->exts->recommond_num:0}}</span>
                            </li>
                            @endif
                            <li class="small">|</li>
                            <div class="bdsharebuttonbox"><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a></div>
                            <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":["qzone","tsina","weixin","douban"],"bdPic":"","bdStyle":"1","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
                            <div class="clearfix"></div>
                        </ul>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="employ-info jiuyezhinan text-left bodertop-213 boderbottom-213 margin-top-10">
                    {!! $result->content !!}
                </div>
                <div class="employ-info">
                    <div class="nice-point">
                        <a href="javacript:void(0)" onclick="toApprove('/approve','employ','{{$result->id}}','{{ csrf_token()}}')"><img src="{{ asset('/images/front/jiuyezhinan/good.png') }}"></a>
                        <div class="nice-point-count" id="nice-point-count">{{count($result->exts)>0?$result->exts->approving_num:0}}</div>
                    </div>
                </div>
            </div>
            @if($result->exam_id > 0  && count($result->examination)>0)
            <div id="jobs-exam">
                <h4 class="c0 pt15 pb15 pl20 ma0">考试</h4>
                <div id="jobs-exam-main" class="row show-grid">
                    <div class="col-xs-10 col-sm-10 col-md-10">
                        <p class="ma lh38 fs16 c6">请参与应聘考试,以便更好的对您进行评估。</p>
                    </div>
                    <div class="col-xs-2 col-sm-2 col-md-2">
                        <div class="employ-exam-link" id="goExam">
                            @if($isToDelivery == 1)
                            <a href="javascript:void(0);">已通过考试</a>
                            @elseif($isToDelivery == 2)
                            <a href="javascript:void(0);" onclick="toExaminations({{ empty($authuser)?0:$authuser->id }})">重新考试</a>
                            @else
                            <a href="javascript:void(0);" onclick="toExaminations({{ empty($authuser)?0:$authuser->id }})">开始考试</a>
                            @endif
                        </div>
                    </div>
                </div>
            </div>
            @if(count($result->examination)>0 && ($isToDelivery != 1))
            @include('front.common.exam')
            @endif
            @endif
            <div id="com-comments-list">
                <h4 class="c0 pt15 pb15 pl20 ma0">全部评论</h4>
                <div id="itemContainer" >
                    @foreach($comments as $k=>$vo)
                    <div class="comment-common" id="comment-common{{$k}}">
                        <div class="comment-user-avatar fl pt10">
                            <img src="{{userlogo($vo->user_id,'middle')}}">
                        </div>
                        <div class="comment-main fl">
                            <div class="comment-content text-left">
                                <p class="font-20 c3">{{getUserName($vo->user_id)}}</p>
                                <p class="fs14 c5">{{$vo->content}}</p>
                                <div class="fs14 c9 ma0">
                                    <div class="fl">
                                        {{$vo->created_at}}&nbsp;&nbsp;&nbsp;&nbsp;
                                        <a href="javascript:;" onclick="showreply({{$vo->comment_id}})">回复</a>
                                    </div>
                                    <div class="fr mr15">
                                        <img src="{{ asset('/images/front/jiuyezhinan/pl.png') }}">
                                        @if(count($vo->childComments)>0)
                                        <input type="text" name="totalnum{{$vo->comment_id}}" value="{{count($vo->childComments)}}" readonly="readonly">
                                        @else
                                        <input type="text" name="totalnum{{$vo->comment_id}}" value="0" readonly="readonly">
                                        @endif
                                    </div>
                                    <div class="clr"></div>
                                </div>
                            </div>
                            <div id="comment-reply{{$vo->comment_id}}" class="comment-reply-form mt20 dn">
                                <div class="comment-reply-form-b">
                                    <textarea id="comment-reply-content{{$vo->comment_id}}" class="fl" placeholder="人可以走,留下你的态度"></textarea>
                                    <button type="button" id="submit{{$vo->comment_id}}" class="fr" @if(empty($authuser))onclick="loginTips()" @else onclick="pushComment('/comment/push?typeid=3','{{$vo->comment_id}}','{{$vo->user_id}}','0','{{$result->id}}','{{ csrf_token() }}')" @endif>发表回复</button>
                                </div>
                            </div>
                            <div id="message{{$vo->comment_id}}" class="commentmsg dn"></div>
                            <div class="comment-child text-left" id="comment-childs{{$vo->comment_id}}">
                                @if(count($vo->childComments)>0)
                                <div class="comment-caret-up"><i class="glyphicon glyphicon-triangle-top"></i></div>
                                <div class="comment-child-content" id="comment-child-content{{$vo->comment_id}}">
                                    @foreach($vo->childComments as $key=>$zn)
                                    @if($key<3)
                                    <div class="comment-child-content-list" >
                                        <p class="fs18 color-green">{{getUserName($zn->user_id)}}：</p>
                                        <p class="fs14 c5">{{$zn->content}}</p>
                                    </div>
                                    @endif
                                    @endforeach
                                </div>
                                @endif
                            </div>
                        </div>
                        <div class="clr"></div>
                    </div>
                    @endforeach
                </div>
                {{-- 分页 --}}
                <div id="holder" @if(count($comments)== 0) class="holder dn" @else class="holder" @endif></div>
                <script>
                  jPages();
                </script>
                <div class="comment-reply-main">
                  <textarea id="comment-reply-content" placeholder="人可以走,留下你的态度"></textarea>
                  <div class="mb20 lh44 mt10">
                    <div id="message" class="fl"></div>
                    <button type="button" class="fr" id="submit-main" @if(empty($authuser))onclick="loginTips()" @else onclick="comment('/comment/push?typeid=3','0','{{$result->id}}','3','{{ csrf_token() }}')" @endif>发表回复</button>
                  </div>
            </div>
        </div>
        </div>
        <div id="test" style="position:absolute; width: 234px; right: 0;" >

            <div class="employ-list-right fl" @if(empty($employSet->toArray())) style="display:none;" @else style="margin-bottom: 1em;" @endif >
                <div class="employ-list-tips">
                    <div class="tips-title">系列导航</div>
                    @foreach($employSet as $k=>$emphots)
                        <div class="tips-content @if($k>0) bodertop @endif">
                            <div class="tips-content-main">
                                <div class="tips-content-title"><a href="{{url('/employ/'.$emphots->id)}}">{{str_limit($emphots->title,22)}}</a></div>
                                <div class="tips-content-views">阅读（ {{ $emphots->exts->reading_num }} ）</div>
                            </div>
                        </div>
                    @endforeach
                </div>
                @foreach ($ads_img as $key => $adimg)
                    <div class="employ-list-tips mt-10">
                        <img src="{{$adimg->attachment($adimg->id)->url}}">
                    </div>
                @endforeach
            </div>
            <div class="employ-list-right fl" @if(!empty($employSet->toArray())) style="display:none;"  @endif>
                <div class="employ-list-tips">
                   <div class="tips-title">人气热点</div>
                   @foreach($hots_employ as $k=>$emphots)
                   <div class="tips-content @if($k>0) bodertop @endif">
                       <div class="tips-content-main">
                           <div class="tips-content-title"><a href="{{url('/employ/'.$emphots->id)}}">{{str_limit($emphots->title,24)}}</a></div>
                           <div class="tips-content-views">阅读（ {{ $emphots->exts->reading_num }} ）</div>
                       </div>
                   </div>
                   @endforeach
               </div>
               @foreach ($ads_img as $key => $adimg)
               <div class="employ-list-tips mt-10">
                   <img src="{{$adimg->attachment($adimg->id)->url}}">
               </div>
               @endforeach
            </div>
        </div>
        <div class="clearfix"></div>
        <div class="slide" style="display: none;">
          <div id="sideToolbar" style="position: fixed; bottom: 30px;">
            <div id="sideCatalog" class="sideCatalogBg" style="visibility: visible;">
                <div id="sideCatalog-sidebar">
                    <div class="sideCatalog-sidebar-top"></div>
                    <div class="sideCatalog-sidebar-bottom"></div>
                </div>
                <div id="sideCatalog-catalog">
                    <dl style="width:175px;zoom:1"></dl>
                </div>
            </div>
            <a id="sideCatalogBtn" class="" style="visibility: visible;" href="javascript:void(0);"></a>
            <a id="sideToolbar-up" style="visibility: visible;" title="返回顶部" href="javascript:void(0)"></a>
          </div>
        </div>
        <div class="clearfix"></div>
    </div>
</div>
<script>

    //右边固定位置
    $(window).scroll(function(){
        var top=$(document).scrollTop();
        var height=$(document).height();
        if (parseInt(top)<250){
            top=0+'px';
        } else {
            top=$(document).scrollTop()-160+'px';
        }
        $('#test').animate({top:top},1,'swing');
    });
	$("span").css({'font-family':'Microsoft Yahei','color':'#666'});
	$("table").attr("width","");
	$("tr").attr("width","");
	$("td").attr("width","");
   	$('h1').addClass('level-1');
    var allEle = $('h1,h2');
    var h1count = $('h1').length;
    var headLen = allEle.length;
    var ddArr = [];
    var m=0;
    var n=0;
    //根据页面内容生成slide导航；
    allEle.each(function(i){
        var sideIndex,
            sideName,
            ddId,
            highlight='',
            ddClass,
            sideAnchor;
        sideName = $(this).text();
        if($(this).hasClass('level-1')){
            var html="<span>"+sideName+"</span>";
            var w = 954 - sideName.length*18 -70;
            html +="<div style='width:"+w+"px;margin-top:14px;float:right;border-top:1px dashed #c2c2c2;'></div>";
            $(this).html(html);
            m++;
            sideAnchor = sideIndex = $(this).find("a").attr('name');
            sideIndex = m;
            ddClass = 'sideCatalog-item1';
        }else{
            sideAnchor = $(this).find("a").attr('name');
            sideIndex = sideAnchor;
            ddClass = 'sideCatalog-item2';
        }
        ddId = 'sideToolbar-item-0-'+ sideAnchor;
        if(i==0){
            highlight = 'highlight';
        }
        var ddHtml = '<dd id="'+ ddId +'" class="'+ddClass + ' ' + highlight +'">'
            +       '<span class="sideCatalog-index1">'+ sideIndex +'</span>'
            +       '<a class="nslog:1026" onclick="return false;" title="part'+sideAnchor+'" href="#'+sideAnchor+'">'+ sideName +'</a>'
            +       '<span class="sideCatalog-dot"></span>'
            +    '</dd>';
        ddArr.push(ddHtml);
    });
    if(allEle.length > 0){
        $('#sideCatalog-catalog dl').html(ddArr.join(''));
    
        //设置导航的位置
        var slideTop = $(window).height() - $('.slide').height();
        $('.slide').css('top',slideTop);
    
        var slideInnerHeight = $('#sideCatalog-catalog dl').height();
        var slideOutHeight = $('#sideCatalog-catalog').height();
        var enableTop = slideInnerHeight - slideOutHeight;
        var step = 50;
    
        //点击导航中的各个目录
        $('#sideCatalog-catalog dl').delegate('dd', 'click', function () {
            var index = $('#sideCatalog-catalog dl dd').index($(this));
            scrollSlide($(this), index);
            var ddIndex = $(this).find('a').stop().attr('href').lastIndexOf('#');
            var ddId = $(this).find('a').stop().attr('href').substring(ddIndex+1);
            var windowTop = $('a[name="' + ddId + '"]').offset().top - 20;
            $('body,html').animate({scrollTop: windowTop}, 'fast');
        })
    
        var contentHeight = $(".jiuyezhinan").height()+100;
        //滚动页面，即滚动条滚动
        $(window).scroll(function () {
            if($(this).scrollTop()>$(this).height() && $(this).scrollTop()<contentHeight){
                $('.slide').show();
            }else{
                $('.slide').hide();
            }
            for (var i=headLen-1; i>=0; i--) {
                if ($(this).scrollTop() >=allEle.eq(i).offset().top - allEle.eq(i).height()) {
                    var index = i;
                    $('#sideCatalog-catalog dl dd').eq(index).addClass('highlight').siblings('dd').removeClass('highlight');
                    scrollSlide($('#sideCatalog-catalog dl dd').eq(index), index);
                    return false;
                } else {
                    $('#sideCatalog-catalog dl dd').eq(0).addClass('highlight').siblings('dd').removeClass('highlight');
                }
            }
        });
    }

    //导航的滚动，以及向上，向下按钮的显示隐藏
    function scrollSlide(that, index){
        if (index < 5) {
            $('#sideCatalog-catalog dl').stop().animate({'top': '0'}, 'fast');
            $('#sideCatalog-down').removeClass('sideCatalog-down-disable').addClass('sideCatalog-down-enable');
            $('#sideCatalog-up').removeClass('sideCatalog-up-enable').addClass('sideCatalog-up-disable');
//         } else if (index > 11) {
//             $('#sideCatalog-catalog dl').stop().animate({'top': -enableTop}, 'fast');
//             $('#sideCatalog-down').removeClass('sideCatalog-down-enable').addClass('sideCatalog-down-disable');
//             $('#sideCatalog-up').removeClass('sideCatalog-up-disable').addClass('sideCatalog-up-enable');
        } else {
            var dlTop = parseInt($('#sideCatalog-catalog dl').css('top')) + slideOutHeight / 2 - (that.offset().top - $('#sideCatalog-catalog').offset().top);
            $('#sideCatalog-catalog dl').stop().animate({'top': dlTop}, 'fast');
            $('#sideCatalog-down').removeClass('sideCatalog-down-disable').addClass('sideCatalog-down-enable');
            $('#sideCatalog-up').removeClass('sideCatalog-up-disable').addClass('sideCatalog-up-enable');
        }
    }

    //置顶
    $('#sideToolbar-up').bind('click', function(){
        $('body,html').animate({scrollTop: 0}, 'fast');
    })

    //slide内容的显示与隐藏
    $('#sideCatalogBtn').bind('click', function(){
        if($(this).hasClass('sideCatalogBtnDisable')){
            $(this).removeClass('sideCatalogBtnDisable');
            $('#sideCatalog').css('visibility','visible');
        }else{
            $(this).addClass('sideCatalogBtnDisable');
            $('#sideCatalog').css('visibility','hidden');
        }
    })

</script>
@stop

<!--底部导航-->
@section('footer')
@parent
@stop

